function fig2_4

global x4

% alpha=1

clf
% get(gcf)
set(gcf,'Position', [25 1115 658 230])
co = [0 0 1;
    0 0.5 0;
    1 0 0;
    0 0.75 0.75;
    0.75 0 0.75;
    0.75 0.75 0;
    0.25 0.25 0.25];
set(groot,'defaultAxesColorOrder',co)
subaxis(1,1,1,1,'MT',0.01,'MB',0.2,'MR',0.01,'ML',0.06,'P',0.04)

nx=100;
x=linspace(0,1,nx);

t=0.02;

uasy(1)=t;
u(1)=1-exp(-t);
for ix=2:nx
    eta=0.5*x(ix)/sqrt(t);
    x4=x(ix)^2/4;
    h0=(2*eta^2+1)*erfc(eta)-2*eta*exp(-eta^2)/sqrt(pi);
    uasy(ix)=t*h0;
    U=int2(@f,0,t);
    u(ix)=erfc(eta)-x(ix)*exp(-t)*U/(2*sqrt(pi));
end

plot(x,uasy,'b','LineWidth',1.3)
hold on
plot(x,u,'--r','LineWidth',1.1)

ax = gca;
ax.XAxis.TickLabelInterpreter = 'latex';
ax.YAxis.TickLabelInterpreter = 'latex';
set(gca,'FontSize',13)

box on
grid on
legend(' Asy',' Exact','Location','NorthEast','FontSize',13,'Interpreter','latex','AutoUpdate','off')

say=['$ t = 0.02$']; 
text(0.1,0.02,say,'FontSize',13,'Interpreter', 'latex')

t=0.1;

uasy(1)=t;
u(1)=1-exp(-t);
for ix=2:nx
    eta=0.5*x(ix)/sqrt(t);
    x4=x(ix)^2/4;
    h0=(2*eta^2+1)*erfc(eta)-2*eta*exp(-eta^2)/sqrt(pi);
    uasy(ix)=t*h0;
    U=int2(@f,0,t);
    u(ix)=erfc(eta)-x(ix)*exp(-t)*U/(2*sqrt(pi));
end
plot(x,uasy,'b','LineWidth',1.3)
hold on
plot(x,u,'--r','LineWidth',1.1)

say=['$ t = 0.1$']; 
text(0.2,0.06,say,'FontSize',13,'Interpreter', 'latex')

xlabel('$x$-axis','Interpreter','latex','FontSize',14)

%exportgraphics(gcf,'/Users/mark/Desktop/diffusion.pdf')

function y=f(r)
global x4
if x4>40*r
    y=0;
else
    y=exp(r-x4/r)/r^1.5;
end
















